package com.sun.common.core.excel.model;

import org.springframework.http.MediaType;
import org.springframework.util.MimeType;

import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.Map;

/**
 * The type Http media type.
 */
@SuppressWarnings(SuppressWarningConstant.UNUSED)
public class HttpMediaType extends MediaType {

    /**
     * Public constant media type for {@code application/cbor}.
     *
     * @since 5.2
     */
    public static final MediaType APPLICATION_EXCEL_XLS;
    /**
     * The constant APPLICATION_EXCEL_XLS_VALUE.
     */
    public static final String APPLICATION_EXCEL_XLS_VALUE = "application/vnd.ms-excel;charset=utf-8";
    /**
     * Public constant media type for {@code application/cbor}.
     *
     * @since 5.2
     */
    public static final MediaType APPLICATION_EXCEL_XLSX;
    /**
     * The constant APPLICATION_EXCEL_XLSX_VALUE.
     */
    public static final String APPLICATION_EXCEL_XLSX_VALUE = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8";

    private static final long serialVersionUID = 278178831989510557L;

    static {
        APPLICATION_EXCEL_XLS = new MediaType("application", "vnd.ms-excel", StandardCharsets.UTF_8);
        APPLICATION_EXCEL_XLSX = new MediaType("application", "vnd.openxmlformats-officedocument.spreadsheetml.sheet", StandardCharsets.UTF_8);
    }

    /**
     * Instantiates a new Http media type.
     *
     * @param type the type
     */
    public HttpMediaType(final String type) {
        super(type);
    }

    /**
     * Instantiates a new Http media type.
     *
     * @param type    the type
     * @param subtype the subtype
     */
    public HttpMediaType(final String type, final String subtype) {
        super(type, subtype);
    }

    /**
     * Instantiates a new Http media type.
     *
     * @param type    the type
     * @param subtype the subtype
     * @param charset the charset
     */
    public HttpMediaType(final String type, final String subtype, final Charset charset) {
        super(type, subtype, charset);
    }

    /**
     * Instantiates a new Http media type.
     *
     * @param type         the type
     * @param subtype      the subtype
     * @param qualityValue the quality value
     */
    public HttpMediaType(final String type, final String subtype, final double qualityValue) {
        super(type, subtype, qualityValue);
    }

    /**
     * Instantiates a new Http media type.
     *
     * @param other   the other
     * @param charset the charset
     */
    public HttpMediaType(final MediaType other, final Charset charset) {
        super(other, charset);
    }

    /**
     * Instantiates a new Http media type.
     *
     * @param other      the other
     * @param parameters the parameters
     */
    public HttpMediaType(final MediaType other, final Map<String, String> parameters) {
        super(other, parameters);
    }

    /**
     * Instantiates a new Http media type.
     *
     * @param type       the type
     * @param subtype    the subtype
     * @param parameters the parameters
     */
    public HttpMediaType(final String type, final String subtype, final Map<String, String> parameters) {
        super(type, subtype, parameters);
    }

    /**
     * Instantiates a new Http media type.
     *
     * @param mimeType the mime type
     */
    public HttpMediaType(final MimeType mimeType) {
        super(mimeType.getType());
    }
}
